
<template>
  <!--  出勤申请 -->
  <div class="ApplicationForm">
    <!-- 头部 --state-->
    <div class="side_1"></div>
    <span class="add_1" style=font-size:16px;>合同详情</span>
    <el-button type="info" icon="el-icon-back" class="btn_fanhui" @click="Fh()">返回</el-button>
    <!-- 头部 --end-->
    <!-- 表格 --start-->
    <div class="body">
      <div class="form_body">
        <!-- 新增文档 -->
        <table>
          <tr>
            <td style="width:10%">合同编号</td>
            <td style="width:40%">
              <el-input
                placeholder="请输入合同名称"
                v-model="item.num"
                style="width:90%;margin:20px 20px"
                v-if="shows==1||item.id>0"
                :disabled="true"
              ></el-input>
              <el-input
                placeholder="请输入合同名称"
                v-model="item.num"
                style="width:90%;margin:20px 20px"
                v-else
              ></el-input>
            </td>
          </tr>
          <tr>
            <td style="width:10%">合同名称</td>
            <td style="width:40%">
              <el-input
                placeholder="请输入合同名称"
                v-model="item.name"
                style="width:90%;margin:20px 20px"
                v-if="shows==1||item.id>0"
                :disabled="true"
              ></el-input>
              <el-input
                placeholder="请输入合同名称"
                v-model="item.name"
                style="width:90%;margin:20px 20px"
                v-else
              ></el-input>
            </td>
          </tr>
          <tr>
            <td style="width:10%">合作企业</td>
            <td>
              <el-input
                placeholder="请输入合作企业"
                v-model="item.comapny"
                style="width:90%;margin:20px 20px"
                v-if="shows==1||item.id>0"
                :disabled="true"
              ></el-input>
              <el-input
                placeholder="请输入合作企业"
                v-model="item.comapny"
                style="width:90%;margin:20px 20px"
                v-else
              ></el-input>
            </td>
          </tr>
          <tr>
            <td>合作项目</td>
            <td colspan="3">
              <el-input
                placeholder="请输入合作项目"
                v-model="item.projectName"
                style="width:90%;margin:20px 20px"
                v-if="shows==1||item.id>0"
                :disabled="true"
              ></el-input>
              <el-input
                placeholder="请输入合作项目"
                v-model="item.projectName"
                style="width:90%;margin:20px 20px"
                v-else
              ></el-input>
            </td>
          </tr>
          <tr>
            <td>存放地址</td>
            <td colspan="3">
              <el-input
                placeholder="请输入存放地址"
                v-model="item.address"
                style="width:90%;margin:20px 20px"
                v-if="shows==1"
                :disabled="true"
              ></el-input>
              <el-input
                placeholder="请输入存放地址"
                v-model="item.address"
                style="width:90%;margin:20px 20px"
                v-else
              ></el-input>
            </td>
          </tr>
          <tr>
            <td>合同金额</td>
            <td colspan="3">
              <el-input
                placeholder="请输入合同金额"
                v-model="item.price"
                style="width:90%;margin:20px 20px"
                v-if="shows==1||item.id>0"
                :disabled="true"
              ></el-input>
              <el-input
                placeholder="请输入合同金额"
                v-model="item.price"
                style="width:90%;margin:20px 20px"
                v-else
              ></el-input>
            </td>
          </tr>
          <!-- </tr> -->
        </table>
      </div>
    </div>

    <!-- end -->
    <div class="btn_bottom" v-show="shows==0">
      <el-button type="primary" size="medium" @click="queDing()">确定</el-button>
      <el-button type="info" size="medium" @click="Fh()">返回</el-button>
    </div>
  </div>
</template>
<script>
import axios from "axios";
export default {
  data () {
    return {
      item: { id: 0, num: "", name: "", comapny: "", projectName: "", address: "", price: "", creater: "", },
      Mark: 0,
      shows: 1,

    };
  },
  created () {
    this.item.creater = JSON.parse(localStorage.getItem("message")).Id;
    this.item.id = this.$route.query.e;
    this.shows = this.$route.query.shows;
    if (this.item.id > 0) { this.geData(); }
  },
  methods: {
    Fh () {
      this.$router.go(-1);
    },
    geData () {
      var obj = { id: this.item.id };
      var objs = JSON.stringify(obj);
      let the = { index: 25, jsondata: objs };
      axios.post("/apis/MyCenter.asmx/GetData", the).then(({ data }) => {
        var list = JSON.parse(data.d);
        if (list == null) { this.$message.error("数据异常"); } else { this.item = list; }
        console.log(list)
      });    },
    queDing () {
      if (this.Mark == 0) {
        if (this.item.num == "") { this.$message.error("合同编号非空"); return }
        if (this.item.name == "") { this.$message.error("合同名称非空"); return }
        if (this.item.comapny == "") { this.$message.error("合作公司非空"); return }
        if (this.item.projectName == "") { this.$message.error("合作项目非空"); return }
        if (this.item.address == "") { this.$message.error("存放地址非空"); return }
        if (this.item.price == "") { this.$message.error("合同金额非空"); return }
        var objs = JSON.stringify(this.item); let the = { index: 6, jsondata: objs };
        this.Mark = 1;
        axios.post("/apis/MyCenter.asmx/Add", the).then(({ data }) => {
          var list = JSON.parse(data.d);
          if (list.flag == true) {
            this.$message.success(list.tip);
            setTimeout(() => {
              window.history.go(-1);
            }, 500);          }
          else { this.$message.error(list.tip); }
        })
      }
    }
  }
};
</script>
<style lang="scss" scoped>
@import '@/assets/scss/base.scss';
.side_1 {
  width: 5px;
  height: 16px;
  background-color: $Header_color;
  margin-left: 10px;
  margin-top: 30px;
}
.add_1 {
  margin-left: 20px;
  margin-top: -20px;
  float: left;
  font-size: 18px;
  font-weight: 400;
}
.btn_fanhui {
  margin-top: -20px;
  margin-right: 20px;
  float: right;
}
.body {
  width: 98%;
  margin: 40px auto;
  background: $white;
  overflow: hidden;
}
.body_jk {
  width: 98%;
  // height: 1000px;
  margin-top: 40px;
  margin-left: 20px;
  background: $white;
  overflow: hidden;
}
.form_body_jk {
  margin-top: 80px;
  width: 1100px;
  border: 1px solid #f5f5f5;
  margin-left: 50px;
  margin-bottom: 70px;
}
.div_title {
  border: 1px solid $bordercolor;

  height: 80px;
  line-height: 80px;
  text-align: center;
  font-size: 18px;
  color: #333333;
  font-weight: 700;
}
.div_title_jk {
  border: 1px solid $bordercolor;

  height: 80px;
  line-height: 80px;
  text-align: center;
  font-size: 18px;
  color: #333333;
  font-weight: 700;
}
.btn_bottom {
  margin-top: 30px;
  margin-left: 45%;
}
.span_text_1 {
  margin-left: 20px;
}
table {
  width: 600px;

  margin: 80px auto;
}
table,
tr {
  height: 60px;
}
tr td {
  border: 1px solid #e7e7e7;
  // border-top: 0.5px;
  text-align: center;
}

.el-select_1 {
  display: inline-block;
}
.add {
  float: right;
  margin-top: -30px;
  margin-right: 15%;
}
.el-input {
  width: 75%;
}
.el-select {
  width: 75%;
}
.table_jk {
  width: 1100px;
}
</style>
<style >
#table_1 {
  width: 65%;
  margin: auto;
  margin-top: 10px;
  margin-bottom: 5px;
}
#table_1 .el-table .cell {
  color: #7e7979;
  font-size: 14px;
  font-weight: 400;
}
#table_1 .el-table th {
  text-align: center;
}
#table_1 .el-table--enable-row-hover .el-table__body tr:hover > td {
  background-color: #fff;
}
</style>


